package com.swak.frame.store;

/**
 * StoreTable.java
 * 
 * @author ColleyMa
 * @date 20-5-22 下午4:28
 * @version v1.0
 */
public class StoreTable {
    private String tableName;
    private Object[] condition;

    private long begin = 0L;

    private long end = -1L;

    public StoreTable(String tableName, Object... condition) {
        this.tableName = tableName;
        this.condition = condition;
    }

    public StoreTable(String tableName) {
        this(tableName, (Object[]) null);
    }

    public StoreTable() {}

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Object[] getCondition() {
        return condition;
    }

    public void setCondition(Object[] condition) {
        this.condition = condition;
    }

    public long getBegin() {
        return begin;
    }

    public void setBegin(long begin) {
        this.begin = begin;
    }

    public long getEnd() {
        return end;
    }

    public void setEnd(long end) {
        this.end = end;
    }

    public static class Builder {
        private String tableName;
        private Object[] condition;
        private long begin = 0L;
        private long end = -1L;

        public Builder tableName(String tableName) {
            this.tableName = tableName;
            return this;
        }

        public Builder condition(Object[] condition) {
            this.condition = condition;
            return this;
        }

        public Builder begin(long begin) {
            this.begin = begin;
            return this;
        }

        public Builder end(long end) {
            this.end = end;
            return this;
        }

        public StoreTable build() {
            return new StoreTable(this);
        }
    }

    private StoreTable(Builder builder) {
        this.tableName = builder.tableName;
        this.condition = builder.condition;
        this.begin = builder.begin;
        this.end = builder.end;
    }
}
